Use binary shaders to reduce the application loading time. By default Kanzi uses online shaders, which Kanzi exports to an application as source code. When the application loads the shaders it compiles the shaders using the GL driver. This compilation prolongs the loading of the application. When you use binary shaders, Kanzi Studio compiles the shaders when you export the kzb file from your project and exports them in binary format. Your target device can use binary shaders immediately.
You can use binary shaders only on GPUs that have driver support for binary shaders and you have the offline shader compiler for the GPU on that device. If the GPU does not support binary shaders, Kanzi Engine compiles shaders from the source. Even though a device may claim support for a specific binary shader format, not all binary shaders are supported.
To use a common binary shader format:
GPU vendor | Name |
---|---|
Imagination Technologies | SGX_BINARY_IMG, or IMG |
ARM Mali | MALI_SHADER_BINARY_ARM |
Vivante | SHADER_BINARY_VIV |
Digital Media Professionals | SHADER_BINARY_DMP |
Fujitsu Semiconductor | GCCSO_SHADER_BINARY_FJ |
NVidia | NVIDIA_PLATFORM_BINARY_NV, or Tegra |
If your target device uses any other GPU and you have the offline shader compiler for that GPU, use for the name the decimal value of the shader format GL constant value.
BinaryShaderCompilerExecutable <vertexshadercode> <vertexshaderbinary>
<vertexshadercode>
and writes to <vertexshaderbinary>
. If your compiler outputs a binary with a suffix, use a wrapper script to output only the binary without the suffix.BinaryShaderCompilerExecutable <fragmentshadercode> <fragmentshaderbinary>
<fragmentshadercode>
and writes to <fragmentshaderbinary>
. If your compiler outputs a binary with a suffix, use a wrapper script to output only the binary without the suffix.GPU vendor | Name |
---|---|
Imagination Technologies | SGX_PROGRAM_BINARY_IMG |
ARM Mali | MALI_PROGRAM_BINARY_ARM |
Vivante | PROGRAM_BINARY_VIV |
Digital Media Professionals |
|
NVidia | NVIDIA_PROGRAM_BINARY_NV |
AMD | Z400_BINARY_AMD |
To test whether the binary shaders work on your device, start your Kanzi application on your device and check the log. The binary shaders work if in the application log you do not see any errors related to binary shaders.